package com.wd.base.component;

import android.text.TextUtils;

import com.wd.base.CommonApi;
import com.wd.base.util.SpUtil;

/**
 * 用户本地信息管理<BR>
 *
 * @author w4425
 * @version [V1.0.0, 2021/4/20]
 * @since V1.0.0
 */
public class UserManager {

    private static String userKey = "user_name";

    /**
     * 是否登录
     *
     * @return
     */
    public static boolean isLogin() {
        if (TextUtils.isEmpty(getName())) {
            return false;
        }
        return true;
    }

    public static String getName() {
        return SpUtil.getInstance(CommonApi.getApplication()).getSp(userKey);

    }

    public static void saveUser(String name) {
        SpUtil.getInstance(CommonApi.getApplication()).putSp(userKey, name);
    }

    public static void clearCount() {
        SpUtil.getInstance(CommonApi.getApplication()).putSp(userKey, "");
    }


}
